home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue35 / 35COM / DeskProp.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-06-10  |  1.6 KB  |  68 lines

  1. unit DeskProp;
  2.  
  3. interface
  4.  
  5. uses SysUtils, Windows, Messages, Classes, Graphics, Controls, StdCtrls,
  6.   ExtCtrls, Forms, ComServ, ComObj, StdVcl, AxCtrls, GIFImage, Dialogs,
  7.   ExpBtn, Buttons;
  8.  
  9. type
  10.   TDesktopProp = class(TPropertyPage)
  11.     Label1: TLabel;
  12.     Label2: TLabel;
  13.     Label3: TLabel;
  14.     Bevel1: TBevel;
  15.     Label4: TLabel;
  16.     ColorDialog1: TColorDialog;
  17.     ForeColor: TBitBtn;
  18.     BackColor: TBitBtn;
  19.     procedure ForeColorClick(Sender: TObject);
  20.   private
  21.     { Private declarations }
  22.   protected
  23.     procedure UpdatePropertyPage; override;
  24.     procedure UpdateObject; override;
  25.   public
  26.     { Public declarations }
  27.   end;
  28.  
  29. const
  30.   Class_DesktopProp: TGUID = '{C5B5EEE1-E9A7-11D1-8CDD-8D1116120B0F}';
  31.  
  32. implementation
  33.  
  34. {$R *.DFM}
  35.  
  36. procedure TDesktopProp.UpdatePropertyPage;
  37. begin
  38.     { Update your controls from OleObject }
  39.     ForeColor.Font.Color := OleObject.TextColor;
  40.     BackColor.Font.Color := OleObject.TextBackgroundColor;
  41. end;
  42.  
  43. procedure TDesktopProp.UpdateObject;
  44. begin
  45.     { Update OleObject from your controls }
  46.     OleObject.TextColor := ForeColor.Font.Color;
  47.     OleObject.TextBackgroundColor := BackColor.Font.Color;
  48. end;
  49.  
  50. procedure TDesktopProp.ForeColorClick(Sender: TObject);
  51. begin
  52.     with Sender as TBitBtn do begin
  53.         ColorDialog1.Color := Font.Color;
  54.         if ColorDialog1.Execute then begin
  55.             Modified;
  56.             Font.Color := ColorDialog1.Color;
  57.         end;
  58.     end;
  59. end;
  60.  
  61. initialization
  62.   TActiveXPropertyPageFactory.Create(
  63.     ComServer,
  64.     TDesktopProp,
  65.     Class_DesktopProp);
  66. end.
  67.  
  68.